load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "session",
    srcs = [
        "advisory_locks.go",
        "bootstrap.go",
        "mock_bootstrap.go",
        "nontransactional.go",
        "session.go",
        "sync_upgrade.go",
        "testutil.go",  #keep
        "tidb.go",
        "txn.go",
        "txnmanager.go",
    ],
    importpath = "github.com/pingcap/tidb/session",
    visibility = ["//visibility:public"],
    deps = [
        "//bindinfo",
        "//config",
        "//ddl",
        "//ddl/placement",
        "//ddl/schematracker",
        "//ddl/syncer",
        "//domain",
        "//domain/infosync",
        "//errno",
        "//executor",
        "//expression",
        "//extension",
        "//extension/extensionimpl",
        "//infoschema",
        "//kv",
        "//meta",
        "//metrics",
        "//owner",
        "//parser",
        "//parser/ast",
        "//parser/auth",
        "//parser/charset",
        "//parser/format",
        "//parser/model",
        "//parser/mysql",
        "//parser/opcode",
        "//parser/terror",
        "//planner",
        "//planner/core",
        "//plugin",
        "//privilege",
        "//privilege/conn",
        "//privilege/privileges",
        "//session/metrics",
        "//session/txninfo",
        "//sessionctx",
        "//sessionctx/binloginfo",
        "//sessionctx/sessionstates",
        "//sessionctx/stmtctx",
        "//sessionctx/variable",
        "//sessiontxn",
        "//sessiontxn/isolation",
        "//sessiontxn/staleread",
        "//statistics/handle",
        "//store/driver/error",
        "//store/driver/txn",
        "//store/helper",
        "//store/mockstore",
        "//table",
        "//table/tables",
        "//table/temptable",
        "//tablecodec",
        "//telemetry",
        "//testkit/testenv",
        "//timer/tablestore",
        "//ttl/ttlworker",
        "//types",
        "//types/parser_driver",
        "//util",
        "//util/chunk",
        "//util/collate",
        "//util/dbterror",
        "//util/dbterror/exeerrors",
        "//util/execdetails",
        "//util/intest",
        "//util/kvcache",
        "//util/logutil",
        "//util/logutil/consistency",
        "//util/mathutil",
        "//util/memory",
        "//util/parser",
        "//util/sem",
        "//util/sli",
        "//util/sqlexec",
        "//util/syncutil",
        "//util/tableutil",
        "//util/timeutil",
        "//util/topsql",
        "//util/topsql/state",
        "//util/topsql/stmtstats",
        "//util/tracing",
        "@com_github_ngaut_pools//:pools",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_pingcap_kvproto//pkg/kvrpcpb",
        "@com_github_pingcap_tipb//go-binlog",
        "@com_github_stretchr_testify//require",
        "@com_github_tikv_client_go_v2//error",
        "@com_github_tikv_client_go_v2//kv",
        "@com_github_tikv_client_go_v2//oracle",
        "@com_github_tikv_client_go_v2//tikv",
        "@com_github_tikv_client_go_v2//util",
        "@io_etcd_go_etcd_client_v3//concurrency",
        "@org_uber_go_atomic//:atomic",
        "@org_uber_go_zap//:zap",
        "@org_uber_go_zap//zapcore",
    ],
)

go_test(
    name = "session_test",
    timeout = "moderate",
    srcs = [
        "bench_test.go",
        "bootstrap_test.go",
        "index_usage_sync_lease_test.go",
        "main_test.go",
        "tidb_test.go",
    ],
    data = glob(["testdata/**"]),
    embed = [":session"],
    flaky = True,
    race = "on",
    shard_count = 50,
    deps = [
        "//autoid_service",
        "//bindinfo",
        "//config",
        "//domain",
        "//executor",
        "//expression",
        "//kv",
        "//meta",
        "//parser/ast",
        "//parser/auth",
        "//planner/core",
        "//sessionctx",
        "//sessionctx/variable",
        "//statistics",
        "//store/mockstore",
        "//tablecodec",
        "//telemetry",
        "//testkit/testmain",
        "//testkit/testsetup",
        "//types",
        "//util",
        "//util/benchdaily",
        "//util/chunk",
        "//util/logutil",
        "//util/sqlexec",
        "@com_github_pingcap_log//:log",
        "@com_github_stretchr_testify//require",
        "@com_github_tikv_client_go_v2//tikv",
        "@org_uber_go_atomic//:atomic",  #keep
        "@org_uber_go_goleak//:goleak",
        "@org_uber_go_zap//:zap",
        "@org_uber_go_zap//zapcore",
    ],
)
